/* Example for creating the chat window. */
#include "mug.h"
#include <stdio.h>
#include <stdlib.h>

int main(void) {
	char buf[900];
	char *message;
	int i;

	loadWindow();

	addLine("First line", AUTO);
	for (i = 0; i < 4; i++)
		addLine("This is a long line that is testing the new line feed feature thing. "
			"I want to add more so that even more lines are taken up by this one "
			"message that is sent into the addLine function."
			"This is a long line that is testing the new line feed feature thing. "
			"I want to add more so that even more lines are taken up by this one "
			"message that is sent into the addLine function.This is a long line "
			"that is testing the new line feed feature thing.", HIGHLIGHT);
	addLine("Last line", AUTO);

/*
	addLine("Thisisalonglinethatistestingthenewlinefeedfeaturething."
		"Iwanttoaddmoresothatevenmorelinesaretakenupbythisonemessage"
		"thatissentintotheaddLinefunction.");
*/
	buf[4] = ' ';
	while(buf[4] != '\n') {
		getLine(buf, sizeof(buf)); 
		message = malloc(strlen(buf)+1);
		strcpy(message, buf);
		sprintf(buf, "me: %s", message);
		addLine(buf, AUTO);
		free(message);
	}

	unloadWindow();

	return 0;
}

